/**
 * Created by minigci.he on 16/10/31.
 */
console.log('---------------')
console.log('test3')

var x = 1;
function f(x, y=x){
    console.log(y)      // 2
}
f(2)


let x2 = 1;
function f2(y2 = x2){
    let x2 = 2;
    console.log(y2)     // 1
}
f2();

function f3(y3 = x3){
    let x3 = 2;
    console.log(y3)     // x3 is not defined
}
// f3();

let foo = 'outer'
function bar( func = x => foo) {
    let foo = 'inner'
    console.log(func())     // 'inner', 书上是'outer'
}
bar();